﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TETRIS_v01.FieldObjects
{
    public class Block
    {
        public int x { get; set; }
        public int y { get; set; }
        public ConsoleColor blockColor { get; set; }
        public string printElement { get; protected set; }

        public Block (int x, int y)
            :this(x,y,ConsoleColor.White){}
        
        public Block (int x, int y, ConsoleColor color)
            : this(x, y, color, "■") { }
        
        public Block(int x, int y, ConsoleColor color, string printElement)
        {
            this.x = x;
            this.y = y;
            blockColor = color;
            this.printElement = printElement;
        }

        public void PrintBlock()
        {
            Console.SetCursorPosition(x, y);
            Console.ForegroundColor = blockColor;
            Console.BackgroundColor = ConsoleColor.Gray;
            Console.Write(printElement);
            Console.ResetColor();
        }

        public void ChangeCoordinates(int stepX, int stepY)
        {
            x = x + stepX;
            y = y + stepY;            
        }       

    }
}
